#
# @lc app=leetcode.cn id=165 lang=python3
#
# [165] 比较版本号
#

# @lc code=start
class Solution:
    def compareVersion(self, version1: str, version2: str) -> int:
        v1 = [int(v) for v in version1.split(r'.')]
        v2 = [int(v) for v in version2.split(r'.')]
        for i in range(max(len(v1), len(v2))):
            vno1 = v1[i] if i < len(v1) else 0
            vno2 = v2[i] if i < len(v2) else 0
            if vno1 < vno2:
                return -1
            elif vno1 > vno2:
                return 1
        return 0
# @lc code=end
